LIBS = @LIBS@

CPPFLAGS = @CPPFLAGS@
CXXFLAGS = @CXXFLAGS@

SUBDIRS = core
CXX = g++
CC = gcc
objects = textarea.o slider.o ball.o requestball.o paddle.o logentry.o summarizer.o logstalgia.o main.o

all:	
	for dir in ${SUBDIRS} ; do ( cd $$dir ; ${MAKE} all ); done
	${MAKE} logstalgia

distclean:
	for dir in ${SUBDIRS} ; do ( cd $$dir ; ${MAKE} distclean ); done
	rm Makefile

clean:
	for dir in ${SUBDIRS} ; do ( cd $$dir ; ${MAKE} clean ); done
	rm -f *.o *.d

logstalgia: $(objects)
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ core/*.o $+ $(LIBS)
	mv $@ ..

%.o: %.cpp
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ -c $<

ifndef NODEPS
ifeq ($(findstring clean,$(MAKECMDGOALS)),)
dfiles = $(patsubst %.o,%.d,$(objects))
%.d: %.cpp
	$(CXX) $(CXXFLAGS) $< -o $@ -MT $(patsubst %.cpp,%.o,$<) -MM $(CPPFLAGS)
-include $(dfiles)
endif
endif # NODEPS
